package leetcode.二叉树;

import java.util.ArrayList;
import java.util.List;

public class 二叉树的后续遍历145 {
    private static List<Integer> res = new ArrayList<>();
    public List<Integer> postorderTraversal(TreeNode root) {
        res.clear();
        process(root);
        return res;
    }

    private static void process(TreeNode root) {
        if(root == null)
            return;
        process(root.left);
        process(root.right);
        res.add(root.val);
    }
}
